package com.example.springbootschedule.common.config;

import org.springframework.stereotype.Component;

import java.util.concurrent.Executors;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Component
public class TaskPoolConfig {

    private ThreadPoolExecutor commonTaskPoolExecutor;

    public TaskPoolConfig() {
        commonTaskPoolExecutor = new ThreadPoolExecutor(10, 100, 5, TimeUnit.MICROSECONDS,
                new SynchronousQueue<Runnable>(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());

    }

    public ThreadPoolExecutor getCommonTaskPoolExecutor() {
        return commonTaskPoolExecutor;
    }

}
